package ids.dev.model;

import ids.dev.util.IDSStringUtil;

import java.io.Serializable;
import java.util.Calendar;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "ids_invoice")
public class Invoice implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="id")
	@SequenceGenerator(allocationSize=1, initialValue=1, sequenceName="invoice_id_seq", name="invoice_id_seq")
	@GeneratedValue(generator="invoice_id_seq", strategy=GenerationType.SEQUENCE)
	private Integer id;
	
	@Column(name="shoppingDate")
	@Temporal(TemporalType.TIMESTAMP)
	private Calendar shoppingDate;
	
	@Column(name="details")
	private String details = IDSStringUtil.STRING_EMPTY;
	
	@Column(name="total")
	private Float total;
	
	@OneToOne
	private SysUser payer;
	
	@OneToMany
	List<Item> itens;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Calendar getShoppingDate() {
		return shoppingDate;
	}

	public void setShoppingDate(Calendar shoppingDate) {
		this.shoppingDate = shoppingDate;
	}

	public String getDetails() {
		return details;
	}

	public void setDetails(String details) {
		this.details = details;
	}

	public Float getTotal() {
		return total;
	}

	public void setTotal(Float total) {
		this.total = total;
	}

	public List<Item> getItens() {
		return itens;
	}

	public void setItens(List<Item> itens) {
		this.itens = itens;
	}

	public SysUser getPayer() {
		return payer;
	}

	public void setPayer(SysUser payer) {
		this.payer = payer;
	}

}
